const app = getApp()

Page({
  data: {
    values: ['2021-06'],
    dateItem: {},
    rangeDate: '',
    multiple: false,
    isRange: false,
    values2: ['2021-06-10', '2021-06-17'],
    extendData: {},
    addedData: {
      openDay: false,
    }
  },
  onLoad() {
    setTimeout(() => {
      this.setData({
        extendData: {
          '2021-06-10': [
            '1.吃饭',
            '2.睡觉',
            '3.打豆豆'
          ]
        },
        'addedData.openDay': true
        // value: '2021-06-06'
      })
    }, 2000)
  },
  calendarChange(e) {
    // e.detail 是个数组，[选中日对象,选中多选或区域]
    this.setData({
      dateItem: e.detail[0],
      rangeDate: `${e.detail[1]}`,
      values: [...e.detail[1]]
    })
  },
  setMultiple() {
    this.setData({
      multiple: !this.data.multiple,
      isRange: false
    })
  },
  setRange() {
    this.setData({
      isRange: !this.data.isRange,
      multiple: false
    })
  },
  setValue() {
    this.setData({
      values: ''
    })
  }
})
